<div class="pageHeader">
	<form id="pagerForm" onsubmit="return navTabSearch(this);"
		action="<?php echo url('functions')?>" method="post">
		<input type="hidden" name="pageNum" value="1" /> <input type="hidden"
			name="numPerPage" value="<?php echo $pagination['numPerPage']?>" />
		<div class="searchBar">
			<table class="searchContent">
				<tr>
					<td width="80">命名空间：</td>
					<td width="150"><select class="combox" name="namespace"
						value="<?php echo $default_namespace?>">
							<option value="0">所有命名空间</option>
							<?php foreach ($namespace as $item):?>
							<option value="<?php echo $item->namespace?>"
							<?php echo	$data['context']->namespace==$item->namespace?'selected':''?>>
								<?php echo $item->namespace?>
							</option>
							<?php endforeach;?>
					</select>
					</td>
				</tr>
				<tr>
					<td colspan="10"><div class="buttonActive">
							<div class="buttonContent">
								<button type="submit">查 看</button>
							</div>
						</div>
					</td>
				</tr>
			</table>
		</div>
	</form>
</div>
<div class="pageContent">
	<div class="panelBar">
		<ul class="toolBar">
			<li><a class="edit"
				href="<?php echo url('admin::functions/prolist')?>"
				target="dialog" width="500" mask="true"><span>功能说明</span> </a>
			</li>
			<li><a class="icon"
				href="<?php echo url('admin::functions/update')?>" target="ajaxTodo"
				mask="true" reloadFlag='1' title="更新所有?"><span>更新所有</span> </a>
			</li>
			<li><a class="delete"
				href="<?php echo url('admin::functions/delete')?>?did={fun_id}"
				target="ajaxTodo" title="确定要删除吗?"><span>删除</span> </a>
			</li>
		</ul>
	</div>
	<table class="table" width="100%" layoutH="143">
		<thead>
			<tr>
				<th width="50">ID</th>
				<th>module</th>
				<th>namespace</th>
				<th>controller</th>
				<th>action</th>
				<th>title</th>
				<th>是否参与权限分配</th>
			</tr>
		</thead>
		<tbody>
		<?php foreach ($data['fetch_data'] as $item):?>
			<tr target="fun_id" rel="<?php echo $item->id?>">
				<td><?php echo $item->id?></td>
				<td><?php echo $item->module?></td>
				<td><?php echo $item->namespace?></td>
				<td><?php echo $item->controller?></td>
				<td><?php echo $item->action?></td>
				<td><input type="text" name="title_<?php echo $item->id;?>"
					fid="<?php echo $item->id;?>" value="<?php echo $item->title;?>"
					onchange="ajax_modify_title(this,'title')" /></td>
				<td><a href="#" fid="<?php echo $item->id;?>"
					ispower="<?php echo $item->ispower?>"
					onclick="ajax_modify_title(this,'ispower')"><?php if ($item->ispower):?>
						<font color="#666">取消</font> <?php else:?> 加入<?php endif;?>
				</a></td>
			</tr>
			<?php endforeach;?>
		</tbody>
	</table>
	<div class="panelBar">
		<div class="pages">
			<span>每页显示</span> <select class="combox" name="numPerPage"
				change="navTabPageBreak" param="numPerPage">
				<option value="20">20</option>
				<option value="50">50</option>
				<option value="100">100</option>
				<option value="200">200</option>
			</select> <span>条，共<?php echo $pagination['totalCount']?>条</span>
		</div>
		<div class="pagination" targetType="navTab"
			totalCount="<?php echo $pagination['totalCount']?>"
			numPerPage="<?php echo $pagination['numPerPage']?>"
			pageNumShown="<?php echo $pagination['pageNumShown']?>"
			currentPage="<?php echo $pagination['currentPage']?>"></div>
	</div>
</div>
<script type="text/javascript">
function ajax_modify_title(obj,act){
	var o = jQuery(obj);
	var _json_data;
	if(act == 'title')
	{
		_json_data = {mid:o.attr('fid'),title:o.val(),act:act};
	}else if(act == 'ispower')
	{
		_json_data = {mid:o.attr('fid'),ispower:o.attr('ispower'),act:act};
	}
	jQuery.post(
		"<?php echo url('functions/modify');?>",
		_json_data,
		function(data){
			if(act == 'ispower')
			{
				navTab.reload();
			}
		}
	);
}
</script>
